﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Honestysoft.Financing.WebUI.Module.Contract
{
    /// <summary>
    /// CheckContract 的摘要说明
    /// </summary>
    public class CheckContract : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string responseData = "";
            string code = context.Request.Params["code"];
            string name = context.Request.Params["name"];
            Honestysoft.Financing.BusinessLogic.Contract bll = new BusinessLogic.Contract("");
            if (bll.IsExistsContractCode(code))
            {
                responseData = "警告：系统检测到合同库中已存在编号为【" + code + "】的合同，请谨慎处理！";
            }
            else
            {
                if (bll.IsExistsContractName(name))
                {
                    responseData = "警告：系统检测到合同库中已存在名称为【" + name + "】的合同，请谨慎处理！";
                }
            }
            context.Response.Write(responseData);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}